from sys import exit
from os import name
from os import system
from sys import argv

def clear_screen():
    if name == 'nt':
        system('cls')
    else:
        system('clear')

def take_input():
    return raw_input("> ")
    
def gold_room():
    print "This room is full of gold. How much will you take?"
    
    try:
        how_much = int(take_input())
    except ValueError:
        dead("Man! Learn to type a number!!!")
    
    if how_much < 50:
        print("Nice! You're not greedy, you win!!!")
        exit(0)
    else:
        dead("You! Greedy bastard!!!")
        
def bear_room():
    print "There is a bear here!"
    print "The bear has bunch of honey."
    print "The fat bear is in front of another door."
    print "How are you going to move the bear?"
    
    bear_moved = False
    
    while True:
        next = take_input()
        if next == "take honey":
            dead("The bear look at you and slaps your face off!");
        elif next == "taunt bear" and not bear_moved:
            print "The bear has moved from the door. You can go through it now"
            bear_moved = True
        elif next == "taunt bear" and bear_moved:
            dead("The bear gets pissed off and chews your leg off.")
        elif next == "open door" and bear_moved:
            gold_room()
        else:
            print "I have no idea what that means."
            
def cthulu_room():
    print "Here you see the great evil Cthulu."
    print "He, it, what ever stared at you and you go insane."
    print "Do you flee for your life or eat your head?"
    
    next = take_input()
    
    if "flee" in next:
        start()
    elif "head" in next:
        dead("Well! that's tasty")
    else:
        cthulu_room()

def dead(why):
    print '-'*10,"YOU ARE DEAD",'-'*10
    print why, "Good job"
    print '-'*(22 + len("YOU ARE DEAD"))
    exit(0)

def start():
    clear_screen()

    print "You are in a dark room!"
    print "There are doors in your left and right!"
    print "Which one do you take"
    
    next = take_input()
    
    if next == "left":
        bear_room()
    elif next == "right":
        cthulu_room()
    else:  
        print "You stumble around the room util you starve"
    
if len(argv) == 2 and argv[1] == '--start':
    start()
